/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sdd.facades.business;

import com.sdd.entities.Address;
import com.sdd.facades.persistence.AddressPersistenceFacade;
import com.sdd.plains.AddressPlain;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;

/**
 *
 * @author Carlos
 */
@Stateless
@LocalBean
public class AddressBusinessFacadeBean {
    
    @EJB
    AddressPersistenceFacade addressPersistenceFacade;

    public Address addAddress(AddressPlain plain) {
        Address a = new Address();
        a.setStreet(plain.getStreet());
        a.setNumber(plain.getNumber());
        a.setCity(plain.getCity());
        a.setCountry(plain.getCountry());
        a.setPostCode(plain.getPostCode());
        return addressPersistenceFacade.create(a);
    }
    
    public Address getAddress(Long id){
        return addressPersistenceFacade.find(id);
    }
    
    
}
